package ch13;

import java.util.*;

public class ViewCustomers extends Option {
	// irrelevant stringarray for menu-visualization
	private ArrayList<String> stringArray = new ArrayList<String>();

	ViewCustomers(int userID, Screen atmScreen, BankDatabase atmBankDatabase,
			Keypad atmKeypad) {
		super(userID, atmScreen, atmBankDatabase);
	}

	public void execute() {
		BankDatabase bankDatabase = getBankDatabase();
		
		// save customer to arraylist customers
		ArrayList<Customer> customers = bankDatabase.getCustomerList();

		stringArray.clear(); // clear the screen box
		stringArray.add("First Name | Last Name | CustomerID | CPR ");
		// foor loop to get all costomers name, customerID, CPR
		for (Customer currentCustomer : customers) {

			stringArray.add(currentCustomer.getFirstName() + " "
					+ currentCustomer.getLastName() + " "
					+ currentCustomer.getCustomerID()+ " "
					+ currentCustomer.getCpr());

			// return current customers informations 
		}// end for loop

		screen.setKasse(stringArray, 10); // set the size of the screen box

	}// end execute
}// end class
